<?php
	$action=request('action',true,false,false,'project_list');
	$handle=request('handle',true,false,false,'project');
	$func=request('func',true,false,false,'project_fun_get_project_list');
	$callback=request('callback',true,false,false,'set_project_info');
	require_once $_site->get_handlepath($handle);
	$page=request('page',false,true,false,1);
	$pagesize=request('pagesize',false,true,false,5);
	$parm = request('parm');//里面的参数为筛选用.分割为键，值如 state.1 多条件用,分割 如state.1,time.1234567891,.........
	$parm2 = $parm;
	$data=array();
	if($parm){
		$parm = explode(',',$parm);
		foreach ($parm as $v){
			list($key,$val) = explode('.',$v);
			$data[$key]=$val;
		}
	}
	$data['title']=request('title');

	$result = $func($data,$page,$pagesize);
	require_once("header.php");
?>

	<script type="text/javascript" charset="utf-8">
		loader.file({
			plugin:['validform/main','dialog/main','my97/wdatepicker'],
			skincss:['list']
		})

		function onclick_set(obj){
			var id=$(obj).attr('idval');
			var title=$(obj).text();
			$('a').removeClass('hover');
			$(obj).addClass('hover');
			var pid = parent.$('#pid').val();
			if(pid == id){
				parent.$('#pid').val("");
				parent.$('#name_title').val("");
				$('a').removeClass('hover');
				return ;
			}
			parent.<?php echo $callback.'(id,title)';?>;
		}
		$(function (){
			var id = parent.$('#pid').val();
			$('a').removeClass('hover');
			if(id>0){
				$('.table').find('a').each(function (){
					if($(this).attr('idval')==id){
						$(this).addClass('hover');
					}
				})
			}
		})
	</script>
	<style type="text/css">
		.table td a.hover{display: line-block;background: #60D277;color: #ffffff;padding:5px;}
	</style>
</head>
<body>
	<div class="main" style=" float:left;">
		<div  class="sos_box" style=" float:left;">
			<form action="" method="post" id="form1">
				<div class="wai">
					<table cellpadding="0" cellspacing="1" border="0" class="table">
						<tr>
							<td><b>关键字：</b></td>
							<td>
								<input class="input ipt3" type="text" name="title" id="title" value="<?php echo $data['title'] ;?>"/>
								<input type="hidden" name="state" value="<?php echo $data['state'] ;?>"/>
								<input class="button1" type="submit" value="搜索">
							</td>
						</tr>						
					</table>

				</div>
			</form>
		</div>
		<table cellpadding="0" cellspacing="1" border="0" class="table">
			<?php
				if($result['rows']){
					foreach ($result['rows'] as $v){
						?>
						<tr>
							<td style="text-align: left">
								<a href="#" idval='<?php echo $v['id'] ;?>' onclick="onclick_set(this);return false;"><?php echo $v['title'] ;?></a>
							</td>
						</tr>
						<?php
					}
				}else{
					?>
					<tr>
						<td colspan="8">暂无数据！</td>
					</tr>
					<?php
				}
			?>
			<tr>
				<td colspan="8">
					<div class="list_more">
						总数：<?php echo $result['row_count']?$result['row_count']:0 ;?>
						<?php
							echo page_method($result['row_count'], $page, $result['page_count'], 0, '?'.preg_replace('/(&page=\d*)/','',$_SERVER['QUERY_STRING']), false);
						?>
					</div>
				</td>
			</tr>
		</table>
	</div>
</body>
</html>